define([
  'jquery',
  'models/AlertMessage',
  'views/View',
  'views/Modal'
], function($, AlertMessage, View, Modal){
  var ItemView = View.extend({
    //tagName: "li",
    initItem: function(){},
    
    initialize: function(options) {
      this.model.bind("destroy", this.remove, this);
      this.model.bind("change", this.render, this);
      //this.model.bind("success_fetch", this.successFecth, this);
      this.initItem(options);
    },
    
    render: function() {
      $(this.el).html(this.template(this.getRenderData()));
      this.hideDetail();
      return this;
    },
    
    hideDetail: function() {
      this.$(".detail").hide();
    },
    
    showDetail: function() {
      this.$(".detail").slideToggle();
    },
    
    successDestroy: function() {
      var modal = new Modal({template: successDestroyTemplate});
      modal.render();
    }
  });

  return ItemView;
});